package com.maimao.model.order;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * @author MaoLin Wang
 * @date 2021/1/15 6:09 下午
 */
@Setter
@Getter
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("mm_order_shop")
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class OrderShop implements Serializable {

    private static final long serialVersionUID = 171228901620343263L;

    @TableId(type = IdType.AUTO)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long id;

    @TableField("order_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long orderId;

    @TableField("shop_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long shopId;

    /**
     * 店铺优惠券id
     */
    @TableField("shop_coupon_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long shopCouponId;


    /**
     * 留言
     */
    private String message;

    /**
     * 运费
     */
    @TableField("delivery_fee")
    private BigDecimal deliveryFee;

    /**
     * 优惠券总减免
     */
    @TableField("coupon_price")
    private BigDecimal couponPrice;

    /**
     * 订单总价（当前店铺的订单总价）
     */
    @TableField("total_price")
    private BigDecimal totalPrice;

    /**
     * 实际需师傅的总价
     */
    @TableField("actual_price")
    private BigDecimal actualPrice;

    /**
     * 订单状态(1-已提交-待付款，2-已付款-待发货，3 部分发货  4 全部发货 5  -交易成功，6-交易取消)
     */
    @TableField("`status`")
    private Integer status;

    /**
     * 物流编号
     */
    @TableField("ship_sn")
    private String shipSn;

    @TableField("ship_name")
    private String shipName;

    /**
     * 1. 存在换货 0 未退换货 默认 0
     */
    @TableField("change_status")
    private Integer changeStatus;

    /**
     * 退货申请id
     */
    @TableField("refund_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long refundId;

    /**
     * 是否开发票
     */
    private Boolean invoice;


    @TableField(exist = false)
    @NotNull(message = "订单商品信息异常")
    private List<OrderGoods> orderGoodsList;
    private Boolean deleted;

    @Override
    public String toString() {
        return "OrderShop{" +
                "id=" + id +
                ", orderId=" + orderId +
                ", shopId=" + shopId +
                ", shopCouponId=" + shopCouponId +
                ", message='" + message + '\'' +
                ", deliveryFee=" + deliveryFee +
                ", couponPrice=" + couponPrice +
                ", totalPrice=" + totalPrice +
                ", actualPrice=" + actualPrice +
                ", status=" + status +
                ", shipSn='" + shipSn + '\'' +
                ", shipName='" + shipName + '\'' +
                ", changeStatus=" + changeStatus +
                ", refundId=" + refundId +
                ", invoice=" + invoice +
                ", deleted=" + deleted +
                '}';
    }
}
